package com.malamute.system.entity;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.malamute.core.entity.BaseEntity;

/**
 * @author AceGuan gjybst@163.com
 * @description 权限
 * @date 2012-2-4 下午03:42:05
 * @version v1.0
 */
@Entity
@Table(name = "T_SYS_PRIVILEGE")
public class Privilege extends BaseEntity {
	private String name;// 权限名称
	private PrivilegeType type = PrivilegeType.URL;// 链接权限

	@ManyToOne(targetEntity = Role.class, fetch = FetchType.EAGER)
	@JoinTable(name = "T_SYS_PRIVILEGE_ROLE_REL", joinColumns = @JoinColumn(name = "p_id", referencedColumnName = "id"), inverseJoinColumns = @JoinColumn(name = "r_id", referencedColumnName = "id"))
	private Role role;

	/**
	 * 获取name
	 * 
	 * @return name
	 */

	public String getName() {
		return name;
	}

	/**
	 * 设置name
	 * 
	 * @param name
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * 获取type
	 * 
	 * @return type
	 */

	public PrivilegeType getType() {
		return type;
	}

	/**
	 * 设置type
	 * 
	 * @param type
	 */
	public void setType(PrivilegeType type) {
		this.type = type;
	}

	/**
	 * 获取role
	 * 
	 * @return role
	 */

	public Role getRole() {
		return role;
	}

	/**
	 * 设置role
	 * 
	 * @param role
	 */
	public void setRole(Role role) {
		this.role = role;
	}

}
